package com.lianniu.web.seller.controller;

import com.lianniu.web.base.BaseResult;
import com.lianniu.web.seller.service.ISupplyProductService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by Administrator on 2017-05-09.
 */
@Controller
@RequestMapping("/rest/supply/product")
public class SupplyProductRestController {

    @Autowired
    private ISupplyProductService supplyProductService;

    @RequestMapping("/supplyNum")
    @ResponseBody
    public BaseResult supplyNum() {
        return supplyProductService.getSupplyNum();
    }

    @RequestMapping("/trend")
    @ResponseBody
    public BaseResult sellerTrend(String pageNum,String userId) {
        int page = 0;
        if(!StringUtils.isBlank(pageNum))
        {
            page = Integer.valueOf(pageNum);
        }
        BaseResult baseResult = supplyProductService.getList(page,userId);
        return baseResult;
    }
}
